home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / glib-2.0 / glib / ghash.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-25  |  4.0 KB  |  112 lines

  1. /* GLIB - Library of useful routines for C programming
  2.  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Lesser General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  12.  * Lesser General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Lesser General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */
  19.  
  20. /*
  21.  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
  22.  * file for a list of people on the GLib Team.  See the ChangeLog
  23.  * files for a list of changes.  These files are distributed with
  24.  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
  25.  */
  26.  
  27. #ifndef __G_HASH_H__
  28. #define __G_HASH_H__
  29.  
  30. #include <glib/gtypes.h>
  31.  
  32. G_BEGIN_DECLS
  33.  
  34. typedef struct _GHashTable  GHashTable;
  35.  
  36. typedef gboolean  (*GHRFunc)  (gpointer  key,
  37.                                gpointer  value,
  38.                                gpointer  user_data);
  39.  
  40. /* Hash tables
  41.  */
  42. GHashTable* g_hash_table_new           (GHashFunc        hash_func,
  43.                         GEqualFunc        key_equal_func);
  44. GHashTable* g_hash_table_new_full             (GHashFunc        hash_func,
  45.                         GEqualFunc        key_equal_func,
  46.                         GDestroyNotify  key_destroy_func,
  47.                         GDestroyNotify  value_destroy_func);
  48. void        g_hash_table_destroy       (GHashTable       *hash_table);
  49. void        g_hash_table_insert           (GHashTable       *hash_table,
  50.                         gpointer        key,
  51.                         gpointer        value);
  52. void        g_hash_table_replace           (GHashTable     *hash_table,
  53.                         gpointer        key,
  54.                         gpointer        value);
  55. gboolean    g_hash_table_remove           (GHashTable       *hash_table,
  56.                         gconstpointer   key);
  57. gboolean    g_hash_table_steal             (GHashTable     *hash_table,
  58.                         gconstpointer   key);
  59. gpointer    g_hash_table_lookup           (GHashTable       *hash_table,
  60.                         gconstpointer   key);
  61. gboolean    g_hash_table_lookup_extended   (GHashTable       *hash_table,
  62.                         gconstpointer   lookup_key,
  63.                         gpointer       *orig_key,
  64.                         gpointer       *value);
  65. void        g_hash_table_foreach       (GHashTable       *hash_table,
  66.                         GHFunc        func,
  67.                         gpointer        user_data);
  68. gpointer    g_hash_table_find       (GHashTable       *hash_table,
  69.                         GHRFunc        predicate,
  70.                         gpointer        user_data);
  71. guint        g_hash_table_foreach_remove       (GHashTable       *hash_table,
  72.                         GHRFunc        func,
  73.                         gpointer        user_data);
  74. guint        g_hash_table_foreach_steal       (GHashTable       *hash_table,
  75.                         GHRFunc        func,
  76.                         gpointer        user_data);
  77. guint        g_hash_table_size           (GHashTable       *hash_table);
  78.  
  79. #ifndef G_DISABLE_DEPRECATED
  80.  
  81. /* The following two functions are deprecated and will be removed in
  82.  * the next major release. They do no good. */
  83. #define g_hash_table_freeze(hash_table) ((void)0)
  84. #define g_hash_table_thaw(hash_table) ((void)0)
  85.  
  86. #endif /* G_DISABLE_DEPRECATED */
  87.  
  88. /* Hash Functions
  89.  */
  90. gboolean g_str_equal (gconstpointer  v1,
  91.                       gconstpointer  v2);
  92. guint    g_str_hash  (gconstpointer  v);
  93.  
  94. gboolean g_int_equal (gconstpointer  v1,
  95.                       gconstpointer  v2);
  96. guint    g_int_hash  (gconstpointer  v);
  97.  
  98. /* This "hash" function will just return the key's address as an
  99.  * unsigned integer. Useful for hashing on plain addresses or
  100.  * simple integer values.
  101.  * Passing NULL into g_hash_table_new() as GHashFunc has the
  102.  * same effect as passing g_direct_hash().
  103.  */
  104. guint    g_direct_hash  (gconstpointer  v) G_GNUC_CONST;
  105. gboolean g_direct_equal (gconstpointer  v1,
  106.                          gconstpointer  v2) G_GNUC_CONST;
  107.  
  108. G_END_DECLS
  109.  
  110. #endif /* __G_HASH_H__ */
  111.  
  112.